from base.Base import Base
from time import sleep
from selenium.webdriver.common.by import By
import logging

class PingLunPage(Base):

    gaunzhu = (By.XPATH,'/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.RelativeLayout/android.widget.LinearLayout/android.widget.RelativeLayout[1]/android.widget.LinearLayout/android.widget.ImageView')

    pinglun = (By.ID,'com.kongfz.app:id/tv_comment_icon')

    dianji = (By.XPATH,'//android.widget.TextView[@resource-id="com.kongfz.app:id/tv_input"]')

    shuru = 'new UiSelector().text("请输入评论内容")'

    fabu = (By.ID,'com.kongfz.app:id/tv_publish')

    dy = (By.XPATH,'/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.view.ViewGroup/androidx.recyclerview.widget.RecyclerView/android.widget.LinearLayout[2]/android.widget.FrameLayout/android.view.ViewGroup/android.widget.TextView[1]')




    def pinglunyewu(self,content):
        #代码步骤
        self.loc_ID(self.gaunzhu).click()
        sleep(3)
        self.driver.swipe(314,1114,314,500,500)
        sleep(3)
        self.loc_wait(self.pinglun).click()
        sleep(3)
        self.loc_ID(self.dianji).click()
        sleep(3)
        self.loc_ui(self.shuru).send_keys(content)
        sleep(3)
        self.loc_ID(self.fabu).click()
        sleep(3)
